﻿using System;
using System.ComponentModel;
using System.Collections.Generic;
using System.Text;
using System.Data;
using System.Data.Common;
using HumanManagement.BusinessObjects;
using HumanManagement.DataAccess;

namespace HumanManagement.BusinessLogic
{
	public class GroupSubFunctionBL
	{

		#region ***** Init Methods ***** 
		GroupSubFunctionDA objGroupSubFunctionDA;
		public GroupSubFunctionBL()
		{
			objGroupSubFunctionDA = new GroupSubFunctionDA();
		}
		#endregion

		#region ***** Get Methods ***** 
		/// <summary>
		/// Get GroupSubFunction by id
		/// </summary>
		/// <param name="id">ID</param>
		/// <returns>GroupSubFunction</returns>
		public GroupSubFunction GetByID(int id)
		{
			return objGroupSubFunctionDA.GetByID(id);
		}

		/// <summary>
		/// Get all of GroupSubFunction
		/// </summary>
		/// <returns>List<<GroupSubFunction>></returns>
		public List<GroupSubFunction> GetList()
		{
			string cacheName = "lstGroupSubFunction";
			if( ServerCache.Get(cacheName) == null )
			{
				ServerCache.Insert(cacheName, objGroupSubFunctionDA.GetList(), "GroupSubFunction");
			}
			return (List<GroupSubFunction>) ServerCache.Get(cacheName);
		}

		/// <summary>
		/// Get DataSet of GroupSubFunction
		/// </summary>
		/// <returns>DataSet</returns>
		public DataSet GetDataSet()
		{
			string cacheName = "dsGroupSubFunction";
			if( ServerCache.Get(cacheName) == null )
			{
				ServerCache.Insert(cacheName, objGroupSubFunctionDA.GetDataSet(), "GroupSubFunction");
			}
			return (DataSet) ServerCache.Get(cacheName);
		}


		/// <summary>
		/// Get all of GroupSubFunction paged
		/// </summary>
		/// <param name="recperpage">recperpage</param>
		/// <param name="pageindex">pageindex</param>
		/// <returns>List<<GroupSubFunction>></returns>
		public List<GroupSubFunction> GetListPaged(int recperpage, int pageindex)
		{
			return objGroupSubFunctionDA.GetListPaged(recperpage, pageindex);
		}

		/// <summary>
		/// Get DataSet of GroupSubFunction paged
		/// </summary>
		/// <param name="recperpage">recperpage</param>
		/// <param name="pageindex">pageindex</param>
		/// <returns>DataSet</returns>
		public DataSet GetDataSetPaged(int recperpage, int pageindex)
		{
			return objGroupSubFunctionDA.GetDataSetPaged(recperpage, pageindex);
		}





		#endregion

		#region ***** Add Update Delete Methods ***** 
		/// <summary>
		/// Add a new GroupSubFunction within GroupSubFunction database table
		/// </summary>
		/// <param name="obj_groupsubfunction">GroupSubFunction</param>
		/// <returns>key of table</returns>
		public int Add(GroupSubFunction obj_groupsubfunction)
		{
			ServerCache.Remove("GroupSubFunction", true);
			return objGroupSubFunctionDA.Add(obj_groupsubfunction);
		}

		/// <summary>
		/// updates the specified GroupSubFunction
		/// </summary>
		/// <param name="obj_groupsubfunction">GroupSubFunction</param>
		/// <returns></returns>
		public void Update(GroupSubFunction obj_groupsubfunction)
		{
			ServerCache.Remove("GroupSubFunction", true);
			objGroupSubFunctionDA.Update(obj_groupsubfunction);
		}

		/// <summary>
		/// Delete the specified GroupSubFunction
		/// </summary>
		/// <param name="id">ID</param>
		/// <returns></returns>
		public void Delete(int id)
		{
			ServerCache.Remove("GroupSubFunction", true);
			objGroupSubFunctionDA.Delete(id);
		}
		#endregion
	}
}
